<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>退货商品</title>
<script type="text/javascript">
    function add() {
        window.open("/stocks/addReturnGoods");
    }

    function manageGoods(id,flag) {
        //提交请求
        $.post("/stocks/manageGoods",{"id":id,"flag":flag},function(data){
            if(data.code == 200)
            {
                alert(data.msg);
                location.reload();
            }else{
                alert(data.msg);return false;
            }
        },"json");

    }
    function outExcel() {
        $("#flag_excel").val(1);
        $("#search").submit();
        $("#flag_excel").val(0);
    }
</script>
<body class="withvernav">
<div class="bodywrapper">
    {{include file='/public/leftmenu.tpl'}}
    <div class="centercontent">
        <div class="pageheader notab">
            <h1 class="pagetitle">退货商品</h1>
            <span class="pagedesc"></span>
            <!--
            <div class="menulist">
                <ul class="profile_summary">
                    {{if $managers || in_array('115',$showpower)}}  <li> <a href="/stocks/addStock" ><span>添加</span></a></li>{{/if}}
                </ul>
            </div>
            -->
        </div>
        <!--pageheader-->
        <div id="contentwrapper" class="contentwrapper">
            <div id="basicform" class="subcontent">
                <!--搜索栏-->
                <div>
                    <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
                </div>
                <form class="stdform stdform2" method="get" id="search" action="/stocks/returnGoodsList">
                    <div class="tableoptions">
                        商品SKU:
                        <input type="text" name="goods_sku" id="goods_sku" class="width200" value="{{$goods_sku}}" placeholder="请输入商品SKU" style="width:120px;"/>
                        商品名称:
                        <input type="text" name="goods_name" id="goods_name" class="width200" value="{{$goods_name}}" placeholder="请输入商品名称" style="width:120px;"/>

                        属性标注：
                        <select class="selectCss2" name="property" id="property">
                            <option value="">请选择</option>
                            <option value="直接退货" {{if $property eq "直接退货"}}selected{{/if}}> 直接退货 </option>
                            <option value="客户退货" {{if $property eq "客户退货"}}selected{{/if}}> 客户退货 </option>
                        </select>
                        工厂：
                        <select class="selectCss2" name="factory" id="factory">
                            <option value="">请选择</option>
                            <option value="1" {{if $factory eq "1"}}selected{{/if}}> 工厂1 </option>
                            <option value="2" {{if $factory eq "2"}}selected{{/if}}> 工厂2 </option>
                        </select>
                        退货状态：
                        <select class="selectCss2" name="flag" id="flag">
                            <option value="">请选择</option>
                            <option value="1" {{if $flag eq "1"}}selected{{/if}}> 新退货 </option>
                            <option value="2" {{if $flag eq "2"}}selected{{/if}}> 正常入库 </option>
                            <option value="3" {{if $flag eq "3"}}selected{{/if}}> 其他处理 </option>
                            <option value="4" {{if $flag eq "4"}}selected{{/if}}> 作废 </option>
                            <option value="5" {{if $flag eq "5"}}selected{{/if}}> 损坏商品 </option>
                        </select>

                        <!--
                        马帮订单:
                        <input type="text" name="mborder" id="mborder" class="width200" value="{{$mborder}}" placeholder="请输入马帮订单" style="width:120px;"/>
                        -->
                        工厂订单:
                        <input type="text" name="fmorder" id="fmorder" class="width200" value="{{$fmorder}}" placeholder="请输入工厂订单" style="width:120px;"/>
                        &nbsp;
                        创建时间:
                        <input type="text"  name="starttime" value="{{$starttime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" /> - <input type="text"  name="endtime" value="{{$endtime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" />
                        &nbsp;
                        <button class="btn btn_orange btn_search radius50">查询</button>
                        <!--
                        <a href="javascript:void();" onClick="searchRecord()">
                            <button class="btn btn_orange btn_search radius50">盘点记录</button>
                        </a>-->
                        &nbsp;&nbsp;&nbsp;
                        <a href="javascript:void();" onClick="add()">
                            <button type="button" class="btn btn_orange btn_search radius50">添加</button>
                        </a>
                        &nbsp;
                        <input type="hidden" id="flag_excel" name = "flag_excel" value="0">
                        <button type="button" class="btn btn_orange btn_search radius50" onclick="outExcel()">导出excel</button>
                    </div>
                </form>
                <!--搜索栏结束-->
                <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
                    <thead>
                    <tr class="lbbt">
                        <td  bgcolor="#FEFFF1">商品SKU</td>
                        <td bgcolor="#FEFFF1" style="width:200px;">商品名称</td>
                        <td  bgcolor="#FEFFF1">商品型号</td>
                        <td  bgcolor="#FEFFF1">退货状态</td>
                        <!--
                        <td  bgcolor="#FEFFF1">马帮订单<br/>复漫订单</td>
                        -->
                        <td  bgcolor="#FEFFF1">工厂订单</td>
                        <td  bgcolor="#FEFFF1">数量</td>
                        <td  bgcolor="#FEFFF1">单价</td>
                        <td  bgcolor="#FEFFF1">工厂</td>
                        <td  bgcolor="#FEFFF1">属性标注</td>
                        <td  bgcolor="#FEFFF1">创建人</td>
                        <!--
                        <td  bgcolor="#FEFFF1">修改人<br/>修改时间</td>
                        -->
                        <td  bgcolor="#FEFFF1">创建时间</td>
                        <td  bgcolor="#FEFFF1" style="width:220px;">描述</td>
                        <td  bgcolor="#FEFFF1">操作</td>
                    </tr>
                    </thead>
                    <tbody >
                    {{foreach from=$stocklist item=li key=key}}
                    <tr>
                        <td valign="middle" bgcolor="#FFFFFF">
                            <a href="/stocks/inStockSearch?goods_sku={{$li.sku}}">{{$li.sku}}</a>
                        </td>
                        <td>
                            {{$li.skuname}}
                        </td>
                        <td bgcolor="#FFFFFF">
                            {{if $li.measure}}
                            {{$li.measure}},{{$li.type}},{{$li.age}}
                            {{/if}}
                        </td>
                        <td  bgcolor="#FFFFFF">
                            {{if $li.flag ==1}}
                                新退货
                            {{/if}}
                            {{if $li.flag ==2}}
                                正常入库
                            {{/if}}
                            {{if $li.flag ==3}}
                                其他处理
                            {{/if}}
                            {{if $li.flag ==4}}
                                作废
                            {{/if}}
                            {{if $li.flag ==5}}
                                损坏商品
                            {{/if}}
                        </td>
                        <td bgcolor="#FFFFFF">
                            {{$li.fmorderid}}
                        </td>
                        <!--
                        <td bgcolor="#FFFFFF">
                            {{$li.mborderid}}
                            <br/>
                            {{$li.fmorderid}}
                        </td>
                        -->
                        <td bgcolor="#FFFFFF">{{$li.ordernum}}</td>
                        <td bgcolor="#FFFFFF">{{$li.price}}</td>
                        <td bgcolor="#FFFFFF">
                            {{if $li.factory==12 || $li.factory==1}}
                                工厂1
                            {{/if}}
                            {{if $li.factory==10 || $li.factory==2}}
                                工厂2
                            {{/if}}
                        </td>
                        <td bgcolor="#FFFFFF">{{$li.property}}</td>
                        <td bgcolor="#FFFFFF">{{$li.createoper}}</td>
                        <!--
                        <td bgcolor="#FFFFFF">{{$li.oper}}<br/>{{$li.opertime}}</td>
                        -->

                        <td bgcolor="#FFFFFF">{{$li.opertime}}</td>
                        <td bgcolor="#FFFFFF">{{$li.descr}}</td>
                        <td bgcolor="#FFFFFF">
                            {{if !$li.flag || $li.flag eq 1}}
                            <a href="javascript:void(0) " onclick="window.open('/stocks/editReturnGoods?id={{$li.id}}');"><span style="color:fuchsia;">编辑</span></a>&nbsp;
                            <a href="javascript:void() " onclick="manageGoods({{$li.id}},4)">  <span style="color:fuchsia;">作废</span></a>
                                <br/>
                            <a href="javascript:void() " onclick="manageGoods({{$li.id}},2)"> <span style="color:purple;">正常入库</span></a>
                                <br/>
                            <a href="javascript:void() " onclick="manageGoods({{$li.id}},3)"><span style="color:olive;">其他处理</span>
                                <br/>
                                <a href="javascript:void() " onclick="manageGoods({{$li.id}},5)"><span style="color:red;">破损商品</span>
                            {{/if}}
                        </td>
                    </tr>
                    {{/foreach}}
                    </tbody>
                </table>
                <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
            </div>
        </div>
</body>
</html>